<template lang="html">
  <div class="search">
    search
    <ul>
      <li v-for="(item, index) in $store.state.city.list" :key="index">
        {{item}}
      </li>
    </ul>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  layout: 'search',
  data() {
    return {
      list: []
    }
  },
  // async mounted() {
  //   let self = this
  //   let {
  //     status,
  //     data: { list }
  //   } = await axios.get('/city/list')
  //   if (status === 200) {
  //     self.list = list
  //   }
  // },
  // asyncData处理组件相关数据
  async asyncData() {
    let {
      status,
      data: { list }
    } = await axios.get('http://localhost:3000/city/list')
    if (status === 200) {
      return {
        list
      }
    }
  }
  // fetch处理VUEX相关数据
}
</script>

<style scoped>
</style>
